n, m = map(int, input().split())
obm = []
obj_list = []
while 1:
    k, s = map(int, input().split())
    obm.append([k, s])
    if len(obm) == n:
        break


class hire(list):
    def __init__(self, num, mark):
        super().__init__()
        self.num = num
        self.mark = mark

    def __lt__(self, other):
        if self.mark == other.mark:
            return self.num < other.num
        return self.mark > other.mark

    def __repr__(self):
        return str(self.num) + " " + str(self.mark)


for i in range(n):
    locals()['a' + str(i)] = hire(obm[i][0], obm[i][1])
    obj_list.append(locals()['a' + str(i)])


obj_list.sort()
a = int(m * 1.5)
for i in obj_list[a:]:
    if i.mark == obj_list[int(m * 1.5) - 1].mark:
        a += 1

print(obj_list[int(m * 1.5) - 1].mark, a)

for obj in obj_list[0:a]:
    print(obj)
